package com.macro.client.controller;

import com.macro.client.service.CouponService;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsCoupon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName CouponController
 * @Description 描述
 * @Author bai
 * @Date 2024/10/24 11:16
 */

@RestController
@RequestMapping("coupon")
public class CouponController {

    @Autowired
    private CouponService couponService;

    @GetMapping("/listByProduct/{productId}")
    public CommonResult<List<SmsCoupon>> listByProduct(@PathVariable Integer productId){
        List<SmsCoupon> list = couponService.listByProduct(productId);
        return CommonResult.success(list);
    }
}
